package cn.wzvtc.ch5_validation;

import cn.wzvtc.ch5_validation.validation.Add;
import cn.wzvtc.ch5_validation.validation.Update;
import lombok.Data;

import javax.validation.constraints.*;
import java.util.Date;

@Data
public class User {
    @NotNull(groups = {Update.class}, message = "更新时id不能为空")
    @Null(groups = {Add.class}, message = "新增时,id必须为空")
    Integer id;

    @NotBlank(message = "用户名不能为空")
    String name;
    String sex;
    @NotNull
    @Min(value = 0, message = "年龄不能小于0岁")
    @Max(value = 120, message = "不能大于120岁")
    Integer age;
    String address;

    Date birthday;
    String email;
    String phone;
}
